package com.ctshk.rpc.starvip.factory.user;

import com.ctshk.rpc.starvip.dto.start_vip.user.*;
import com.ctshk.rpc.starvip.factory.StarVipReqProvider;
import com.ctshk.rpc.starvip.req.user.UserInfoQueryReq;
import com.google.common.collect.Lists;

/**
 * @BelongsProject: ctshk-cloud
 * @BelongsPackage: com.ctshk.rpc.starvip.factory
 * @Author: hef
 * @CreateTime: 2021-04-12 11:02
 * @Description: 个人客户信息查询
 */
public class UserInfoReqFactory extends StarVipReqProvider<UserInfoQueryReq> {

    public UserInfoReqFactory(UserInfoQueryReq userInfoQueryReq) {
        super(userInfoQueryReq);
    }

    @Override
    public UserInfo produce() {
        UserInfo personalCustomerInformationQuery = new UserInfo();
        personalCustomerInformationQuery.setMessageId("1-FDUZ");
        personalCustomerInformationQuery.setIntObjectName("CIFContact");
        personalCustomerInformationQuery.setInterfaceId("CTS_IF_01");
        personalCustomerInformationQuery.setOperation("Query");
        personalCustomerInformationQuery.setMessageType("Integration Object");
        personalCustomerInformationQuery.setIntObjectFormat("Siebel Hierarchical");
        Contact contact = new Contact();
        contact.setId(req.getId());
        contact.setCellularPhone(req.getCellularPhone());
        contact.setEmailAddress(req.getEmailAddress());
        contact.setCtsIdentityNum(req.getCtsIdentityNum());
        contact.setCtsIdentityType(req.getCtsIdentityType());
        contact.setListOfLoyMember(
                new ListOfLoyMember()
                        .setLoyMember(Lists.newArrayList(
                                new LoyMember()
                                        .setId(req.getId())
                                        .setGroupId(req.getGroupId())
                                        .setCtsLogin(req.getCtsLogin())
                                        .setListOfLoyMembershipCard(
                                                new ListOfLoyMembershipCard()
                                                        .setLoyMembershipCard(Lists.newArrayList(
                                                                new LoyMembershipCard(req.getCardNumber(), req.getCardType(), req.getCtsCardNumber())
                                                        ))
                                        )
                        )));
        personalCustomerInformationQuery.setListOfContact(new ListOfContact(Lists.newArrayList(contact)));
        return personalCustomerInformationQuery;
    }
}
